The present invention relates to a graphic apparatus which realizes clipping with simple hardware.
In a graphic apparatus, data is processed so as to display a figure expressed within a predetermined coordinate plane within a specific region on a screen. In this case, this specific region is generally a square region having sides parallel to the x- and y-axes. Processing for eliminating the portion of the figure falling outside this region is termed windowing. Clipping is generally known as one of windowing techniques.
FIG. 1 is a block diagram showing a partial configuration of a conventional graphic apparatus which realizes clipping. Referring to FIG. 1, an arithmetic unit 11 performs various arithmetic operations for graphics processing. A bit map memory 12 stores data corresponding to a graphic pattern. The bit map memory 12 generally has a one-dimensional address space and the addresses logically correspond to the coordinate plane for developing a figure. Data to be written in the bit map memory 12 is temporarily stored in a register 15 through a common data bus 101 and is then supplied to the bit map memory 12. The data read out from the bit map memory 12 is supplied to an output controller 17 which supplies display data to a CRT display unit. The data read out from the bit map memory 12 is also temporarily stored in a register 16 and is then supplied to the common data bus 101.
The read and write operations of data into and from the bit map memory 12 as described above are controlled by a memory controller 13. The memory controller 13 receives a control signal m1 from the arithmetic unit 11 through a control bus 103 and also receives a control signal m2 from a display controller 18. In accordance with these signals, the memory controller 13 controls the read and write operations of data into and from the bit map memory 12. In response to an address supplied through an address bus 102, a memory address controller 14 supplies to the bit map memory 12 a read address or a write address of the bit map memory 12.
In the bit map memory 12, as shown in FIG. 2, one word consists of 16 bits and memory locations from address 0 to address 8191 are allocated. The capacity of the bit map memory 12 corresponds to the effective screen area of the CRT display unit. The screen of the CRT unit has 512 dots in the horizontal direction and 256 dots in the vertical direction, as shown in FIG. 2. FIG. 3 shows the state wherein the contents of the bit map memory 12 are updated upon drawing graphic elements. For example, when a straight line 30 is first drawn and then a straight line 31 is drawn, contents 32 of the bit map memory 12 corresponding to a portion of the line surrounded by a thick slice i are changed to contents 33.
A coordinate plane as shown in FIG. 4 is considered in the graphic apparatus as described above. A rectangular area defined in the coordinate plane by points of coordinates Ps (Xs, Ys) and Pe (Xe, Ye) will be referred to as a clip area 40. The clip function allows development (i.e., display) of a figure within the clip area 40 alone. More specifically, when a straight line connecting points of coordinates P1 (X1, Y1) and P2 (X2, Y2) is drawn, as shown in FIG. 4, the arithmetic unit 11 calculates a point Pi (Xi, Yi) between the two points P.sub.1 and P.sub.2 in accordance with an equation (1) below: EQU Y=(Y2-Y1).multidot.(X-Xi)/(X2-X1)+Yi (1)
The contents (M) at the address of the bit map memory 12 which are converted in accordance with an equation (3) below in correspondence with a point Pi (Xi, Yi) satisfying relations (2) below are fetched in the arithmetic unit 11: EQU Xs.ltoreq.Xi.ltoreq.Xe, Ys.ltoreq.Yi.ltoreq.Ye (2) EQU M=32Y+[X/16] (3)
where [X/16] is an integral part of X/16. The arithmetic unit 11 creates data with set bit data (B) given by an equation (4) below: EQU B=X-16(n-1) (4)
where n is an integer of 1 or more which renders the right side of the equation (4) minimum. The data processed in this manner is stored at the original address of the bit map memory 12 through the register 15 from which it was read out. Then, the line segment within the clip area 40 alone (i.e., between the points P.sub.1 and P.sub.3) is displayed, and the clip function is completed.
However, in a conventional graphic apparatus, such a clip function as described above is performed under program control of the arithmetic unit (generally comprising a microprocessor). This results in a low graphic processing speed and a complex program being stored in the arithmetic unit.